<template>
  <div v-loading="loading" class="app-container">
    <el-button type="primary" @click="getList()">加载列表</el-button>
    <el-button type="primary" @click="$router.push({path:'/exchange/add'})">新建账户</el-button>

    <el-table
      :data="dataList"
      style="width: 100%"
    >
      <el-table-column
        prop="id"
        label="编号"
        width=""
      />
      <el-table-column
        prop="name"
        label="名称"
        width=""
      />
      <el-table-column
        prop="platformSign"
        label="平台"
        width=""
      />
      <el-table-column
        prop="accessKey"
        label="AccessKey"
        width=""
      />
      <el-table-column
        prop="secretKey"
        label="SecretKey"
        width=""
      />

    </el-table>

  </div>
</template>

<script>
import exchangeApi from '@/api/exchange'
export default {
  data() {
    return {
      loading: false,
      dataList: []
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true
      exchangeApi.getList().then((resp) => {
        this.$message(`列表加载完成`)
        if (resp.data) {
          this.dataList = resp.data
        }
      })
        .finally(p => {
          this.loading = false
        })
    }
  }
}
</script>

<style scoped>
.line {
  text-align: center;
}
</style>

